﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Web;

namespace text.Utils
{
    public class DbHelper
    {
        public static DataSet Query(string sql)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
            return ds;
        }
        public static int Execute(string sql)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
            SqlCommand sqlCommand = new SqlCommand(sql, conn);
            conn.Open();
            int flag = sqlCommand.ExecuteNonQuery();
            conn.Close();
            return flag;
        }
    }
}